package com.aplink.generic.dictionary;

import java.io.Serializable;

import android.util.SparseArray;

public class GenericDictionary<K, T> extends SparseArray<T> implements
        Serializable {

    private static final long serialVersionUID = -6701388632335830083L;

    public void append(final K key, final T value) {
        super.append(key.hashCode(), value);
    }

    public boolean containsKey(final K key) {
        if (this.get(key.hashCode()) != null) {
            return true;
        }
        return false;
    }

    public void delete(final K key) {
        super.delete(key.hashCode());
    }

    public T get(final K key) {
        return super.get(key.hashCode());
    }

    public T get(final K key, final T valueIfKeyNotFound) {
        return super.get(key.hashCode(), valueIfKeyNotFound);
    }

    public int indexOfKey(final K key) {
        return super.indexOfKey(key.hashCode());
    }

    public boolean isEmpty() {
        return size() == 0;
    }

    public void put(final K key, final T value) {
        super.put(key.hashCode(), value);
    }

    public void remove(final K key) {
        super.remove(key.hashCode());
    }

    public void setValueAt(final K index, final T value) {
        super.setValueAt(index.hashCode(), value);
    }
}
